<?php

		
function inventoryToTable($inventory,$name){
	  global $itemType;
			global $itemTopSize;
			global $itemSize;
			global $itemColor;
			global $itemMaterial;
			global $itemSeason;
			global $itemYear;
			global $itemType;
			global $itemDesigner;
			global $organizationType;
			echo "0000000000000";
			print_r($organizationType);
			
	$name=$name.'Table';
	
	$result="<style type='text/css' title='currentStyle'>
			@import 'css/demo_page.css';
			@import 'css/demo_table.css';
		</style>
		<script type='text/javascript' language='javascript' src='js/jquery.js'></script>
		<script type='text/javascript' language='javascript' src='js/jquery.dataTables.js'></script>
<script type='text/javascript' charset='utf-8'>
			$(document).ready(function() {
				$('#$name').dataTable();
			} );
		</script>
	<table cellpadding='0' cellspacing='0' border='0' class='display' id='".$name."' width='100%'>";
	$resulthead="<thead>
		<tr>
			<th>数量</th>
			<th>扫描条码</th>
			<th>生产款号</th>
			<th>设计版号</th>
			<th>类型</th>
	        <th>年份</th>
			<th>季节</th>
			<th>流水号</th>
			<th>面料</th>
			<th>色彩</th>
			<th>尺寸</th>
	        <th>设计师</th>
			<th>原价</th>
			<th>折率</th>
			<th>现售与否</th>
			<th>产品名</th>
		</tr>
	</thead>
	<tbody>";
	
	$resultfoot=	"
	</tbody>
		<tfoot>
		  <tr>
			<th>数量</th>
			<th>扫描条码</th>
			<th>生产款号</th>
			<th>设计版号</th>
			<th>类型</th>
	        <th>年份</th>
			<th>季节</th>
			<th>流水号</th>
			<th>面料</th>
			<th>色彩</th>
			<th>尺寸</th>
	        <th>设计师</th>
			<th>原价</th>
			<th>折率</th>
			<th>现售与否</th>
			<th>产品名</th>
		   </tr>
		</tfoot>
	</table>";
	
	$resultContent="";
	$label='odd';
	$grade='gradeC';
	foreach($inventory as $inv){
					
			$number=$inv['number'];
			$scan_code=$inv['item']->scan_code;
			$product_code=$inv['item']->product_code;
			$designer_code=$inv['item']->designer_code;
			$type=$itemType[$inv['item']->type];
			$year=$itemYear[$inv['item']->year];
			$season=$itemSeason[$inv['item']->season];
			$flow=$inv['item']->flow;
			$material=$itemMaterial[$inv['item']->material];
			$size=$itemSize[$inv['item']->size];
			$color=$itemColor[$inv['item']->color];
			$designer=$itemDesigner[$inv['item']->designer];
		$price=$inv['item']->price;
		$ratio=$inv['item']->ratio."%";
		$active=($inv['item']->active==1) ? '是' : '否';
	    $name=$inv['item']->name;
	    $grade="";
	    if($inv['item']->active!=1){
	 	 	$grade='gradeU';
	    }elseif($ratio!='100%'){
	    	$grade='gradeX';
	    }else{
	    	$grade='gradeC';
	    }
	    if($label=='odd'){
	    	$label='even';
	    }else{
	    	$label='odd';
	    }
	    echo $label." ".$grade."<br>";
		$resultContent.="<tr class='$grade'>
			
			
			
		<td>$number</td>
		<td>$scan_code</td>
		<td>$product_code</td>
		<td>$designer_code</td>
		<td>$type</td>
		<td>$year</td>
		<td>$season</td>
		<td>$flow</td>
		<td>$material</td>
		<td>$color</td>
		<td>$size</td>
		<td>$designer</td>
		
				<td>$price</td>	
		<td>$ratio</td>	
		<td>$active</td>	
		
		<td>$name</td>
		</tr>";
		
		
	}
	return $result.$resulthead.$resultContent.$resultfoot;
/*
<table cellpadding='0' cellspacing='0' border='0' class='display' id='example' width='100%'>
	<thead>
		<tr>
			<th>Rendering engine</th>
			<th>Browser</th>
			<th>Platform(s)</th>
			<th>Engine version</th>
			<th>CSS grade</th>
		</tr>
	</thead>
	<tbody>
		<tr class='odd gradeX'>
			<td>Trident</td>
			<td>Internet
				 Explorer 4.0</td>
			<td>Win 95+</td>
			<td class='center'> 4</td>
			<td class='center'>X</td>
		</tr>
		<tr class='even gradeC'>
			<td>Trident</td>
			<td>Internet
				 Explorer 5.0</td>
			<td>Win 95+</td>
			<td class='center'>5</td>
			<td class='center'>C</td>
		</tr>
		<tr class='odd gradeA'>
			<td>Trident</td>
			<td>Internet
				 Explorer 5.5</td>
			<td>Win 95+</td>
			<td class='center'>5.5</td>
			<td class='center'>A</td>
		</tr>
		<tr class='even gradeA'>
			<td>Trident</td>
			<td>Internet
				 Explorer 6</td>
			<td>Win 98+</td>
			<td class='center'>6</td>
			<td class='center'>A</td>
		</tr>
		<tr class='odd gradeA'>
			<td>Trident</td>
			<td>Internet Explorer 7</td>
			<td>Win XP SP2+</td>
			<td class='center'>7</td>
			<td class='center'>A</td>
		</tr>
		<tr class='even gradeA'>
			<td>Trident</td>
			<td>AOL browser (AOL desktop)</td>
			<td>Win XP</td>
			<td class='center'>6</td>
			<td class='center'>A</td>
		</tr>
		<tr class='gradeA'>
			<td>Gecko</td>
			<td>Firefox 1.0</td>
			<td>Win 98+ / OSX.2+</td>
			<td class='center'>1.7</td>
			<td class='center'>A</td>
		</tr>
		<tr class='gradeA'>
			<td>Gecko</td>
			<td>Firefox 1.5</td>
			<td>Win 98+ / OSX.2+</td>
			<td class='center'>1.8</td>
			<td class='center'>A</td>
		</tr>
		<tr class='gradeA'>
			<td>Gecko</td>
			<td>Firefox 2.0</td>
			<td>Win 98+ / OSX.2+</td>
			<td class='center'>1.8</td>
			<td class='center'>A</td>
		</tr>
		<tr class='gradeA'>
			<td>Gecko</td>
			<td>Firefox 3.0</td>
			<td>Win 2k+ / OSX.3+</td>
			<td class='center'>1.9</td>
			<td class='center'>A</td>
		</tr>
		<tr class='gradeA'>
			<td>Gecko</td>
			<td>Camino 1.0</td>
			<td>OSX.2+</td>
			<td class='center'>1.8</td>
			<td class='center'>A</td>
		</tr>
		<tr class='gradeA'>
			<td>Gecko</td>
			<td>Camino 1.5</td>
			<td>OSX.3+</td>
			<td class='center'>1.8</td>
			<td class='center'>A</td>
		</tr>
		<tr class='gradeA'>
			<td>Gecko</td>
			<td>Netscape 7.2</td>
			<td>Win 95+ / Mac OS 8.6-9.2</td>
			<td class='center'>1.7</td>
			<td class='center'>A</td>
		</tr>
		<tr class='gradeA'>
			<td>Gecko</td>
			<td>Netscape Browser 8</td>
			<td>Win 98SE+</td>
			<td class='center'>1.7</td>
			<td class='center'>A</td>
		</tr>
		<tr class='gradeA'>
			<td>Gecko</td>
			<td>Netscape Navigator 9</td>
			<td>Win 98+ / OSX.2+</td>
			<td class='center'>1.8</td>
			<td class='center'>A</td>
		</tr>
		<tr class='gradeA'>
			<td>Gecko</td>
			<td>Mozilla 1.0</td>
			<td>Win 95+ / OSX.1+</td>
			<td class='center'>1</td>
			<td class='center'>A</td>
		</tr>
		<tr class='gradeA'>
			<td>Gecko</td>
			<td>Mozilla 1.1</td>
			<td>Win 95+ / OSX.1+</td>
			<td class='center'>1.1</td>
			<td class='center'>A</td>
		</tr>
		<tr class='gradeA'>
			<td>Gecko</td>
			<td>Mozilla 1.2</td>
			<td>Win 95+ / OSX.1+</td>
			<td class='center'>1.2</td>
			<td class='center'>A</td>
		</tr>
		<tr class='gradeA'>
			<td>Gecko</td>
			<td>Mozilla 1.3</td>
			<td>Win 95+ / OSX.1+</td>
			<td class='center'>1.3</td>
			<td class='center'>A</td>
		</tr>
		<tr class='gradeA'>
			<td>Gecko</td>
			<td>Mozilla 1.4</td>
			<td>Win 95+ / OSX.1+</td>
			<td class='center'>1.4</td>
			<td class='center'>A</td>
		</tr>
		<tr class='gradeA'>
			<td>Gecko</td>
			<td>Mozilla 1.5</td>
			<td>Win 95+ / OSX.1+</td>
			<td class='center'>1.5</td>
			<td class='center'>A</td>
		</tr>
		<tr class='gradeA'>
			<td>Gecko</td>
			<td>Mozilla 1.6</td>
			<td>Win 95+ / OSX.1+</td>
			<td class='center'>1.6</td>
			<td class='center'>A</td>
		</tr>
		<tr class='gradeA'>
			<td>Gecko</td>
			<td>Mozilla 1.7</td>
			<td>Win 98+ / OSX.1+</td>
			<td class='center'>1.7</td>
			<td class='center'>A</td>
		</tr>
		<tr class='gradeA'>
			<td>Gecko</td>
			<td>Mozilla 1.8</td>
			<td>Win 98+ / OSX.1+</td>
			<td class='center'>1.8</td>
			<td class='center'>A</td>
		</tr>
		<tr class='gradeA'>
			<td>Gecko</td>
			<td>Seamonkey 1.1</td>
			<td>Win 98+ / OSX.2+</td>
			<td class='center'>1.8</td>
			<td class='center'>A</td>
		</tr>
		<tr class='gradeA'>
			<td>Gecko</td>
			<td>Epiphany 2.20</td>
			<td>Gnome</td>
			<td class='center'>1.8</td>
			<td class='center'>A</td>
		</tr>
		<tr class='gradeA'>
			<td>Webkit</td>
			<td>Safari 1.2</td>
			<td>OSX.3</td>
			<td class='center'>125.5</td>
			<td class='center'>A</td>
		</tr>
		<tr class='gradeA'>
			<td>Webkit</td>
			<td>Safari 1.3</td>
			<td>OSX.3</td>
			<td class='center'>312.8</td>
			<td class='center'>A</td>
		</tr>
		<tr class='gradeA'>
			<td>Webkit</td>
			<td>Safari 2.0</td>
			<td>OSX.4+</td>
			<td class='center'>419.3</td>
			<td class='center'>A</td>
		</tr>
		<tr class='gradeA'>
			<td>Webkit</td>
			<td>Safari 3.0</td>
			<td>OSX.4+</td>
			<td class='center'>522.1</td>
			<td class='center'>A</td>
		</tr>
		<tr class='gradeA'>
			<td>Webkit</td>
			<td>OmniWeb 5.5</td>
			<td>OSX.4+</td>
			<td class='center'>420</td>
			<td class='center'>A</td>
		</tr>
		<tr class='gradeA'>
			<td>Webkit</td>
			<td>iPod Touch / iPhone</td>
			<td>iPod</td>
			<td class='center'>420.1</td>
			<td class='center'>A</td>
		</tr>
		<tr class='gradeA'>
			<td>Webkit</td>
			<td>S60</td>
			<td>S60</td>
			<td class='center'>413</td>
			<td class='center'>A</td>
		</tr>
		<tr class='gradeA'>
			<td>Presto</td>
			<td>Opera 7.0</td>
			<td>Win 95+ / OSX.1+</td>
			<td class='center'>-</td>
			<td class='center'>A</td>
		</tr>
		<tr class='gradeA'>
			<td>Presto</td>
			<td>Opera 7.5</td>
			<td>Win 95+ / OSX.2+</td>
			<td class='center'>-</td>
			<td class='center'>A</td>
		</tr>
		<tr class='gradeA'>
			<td>Presto</td>
			<td>Opera 8.0</td>
			<td>Win 95+ / OSX.2+</td>
			<td class='center'>-</td>
			<td class='center'>A</td>
		</tr>
		<tr class='gradeA'>
			<td>Presto</td>
			<td>Opera 8.5</td>
			<td>Win 95+ / OSX.2+</td>
			<td class='center'>-</td>
			<td class='center'>A</td>
		</tr>
		<tr class='gradeA'>
			<td>Presto</td>
			<td>Opera 9.0</td>
			<td>Win 95+ / OSX.3+</td>
			<td class='center'>-</td>
			<td class='center'>A</td>
		</tr>
		<tr class='gradeA'>
			<td>Presto</td>
			<td>Opera 9.2</td>
			<td>Win 88+ / OSX.3+</td>
			<td class='center'>-</td>
			<td class='center'>A</td>
		</tr>
		<tr class='gradeA'>
			<td>Presto</td>
			<td>Opera 9.5</td>
			<td>Win 88+ / OSX.3+</td>
			<td class='center'>-</td>
			<td class='center'>A</td>
		</tr>
		<tr class='gradeA'>
			<td>Presto</td>
			<td>Opera for Wii</td>
			<td>Wii</td>
			<td class='center'>-</td>
			<td class='center'>A</td>
		</tr>
		<tr class='gradeA'>
			<td>Presto</td>
			<td>Nokia N800</td>
			<td>N800</td>
			<td class='center'>-</td>
			<td class='center'>A</td>
		</tr>
		<tr class='gradeA'>
			<td>Presto</td>
			<td>Nintendo DS browser</td>
			<td>Nintendo DS</td>
			<td class='center'>8.5</td>
			<td class='center'>C/A<sup>1</sup></td>
		</tr>
		<tr class='gradeC'>
			<td>KHTML</td>
			<td>Konqureror 3.1</td>
			<td>KDE 3.1</td>
			<td class='center'>3.1</td>
			<td class='center'>C</td>
		</tr>
		<tr class='gradeA'>
			<td>KHTML</td>
			<td>Konqureror 3.3</td>
			<td>KDE 3.3</td>
			<td class='center'>3.3</td>
			<td class='center'>A</td>
		</tr>
		<tr class='gradeA'>
			<td>KHTML</td>
			<td>Konqureror 3.5</td>
			<td>KDE 3.5</td>
			<td class='center'>3.5</td>
			<td class='center'>A</td>
		</tr>
		<tr class='gradeX'>
			<td>Tasman</td>
			<td>Internet Explorer 4.5</td>
			<td>Mac OS 8-9</td>
			<td class='center'>-</td>
			<td class='center'>X</td>
		</tr>
		<tr class='gradeC'>
			<td>Tasman</td>
			<td>Internet Explorer 5.1</td>
			<td>Mac OS 7.6-9</td>
			<td class='center'>1</td>
			<td class='center'>C</td>
		</tr>
		<tr class='gradeC'>
			<td>Tasman</td>
			<td>Internet Explorer 5.2</td>
			<td>Mac OS 8-X</td>
			<td class='center'>1</td>
			<td class='center'>C</td>
		</tr>
		<tr class='gradeA'>
			<td>Misc</td>
			<td>NetFront 3.1</td>
			<td>Embedded devices</td>
			<td class='center'>-</td>
			<td class='center'>C</td>
		</tr>
		<tr class='gradeA'>
			<td>Misc</td>
			<td>NetFront 3.4</td>
			<td>Embedded devices</td>
			<td class='center'>-</td>
			<td class='center'>A</td>
		</tr>
		<tr class='gradeX'>
			<td>Misc</td>
			<td>Dillo 0.8</td>
			<td>Embedded devices</td>
			<td class='center'>-</td>
			<td class='center'>X</td>
		</tr>
		<tr class='gradeX'>
			<td>Misc</td>
			<td>Links</td>
			<td>Text only</td>
			<td class='center'>-</td>
			<td class='center'>X</td>
		</tr>
		<tr class='gradeX'>
			<td>Misc</td>
			<td>Lynx</td>
			<td>Text only</td>
			<td class='center'>-</td>
			<td class='center'>X</td>
		</tr>
		<tr class='gradeC'>
			<td>Misc</td>
			<td>IE Mobile</td>
			<td>Windows Mobile 6</td>
			<td class='center'>-</td>
			<td class='center'>C</td>
		</tr>
		<tr class='gradeC'>
			<td>Misc</td>
			<td>PSP browser</td>
			<td>PSP</td>
			<td class='center'>-</td>
			<td class='center'>C</td>
		</tr>
		<tr class='gradeU'>
			<td>Other browsers</td>
			<td>All others</td>
			<td>-</td>
			<td class='center'>-</td>
			<td class='center'>U</td>
		</tr>
	</tbody>
	<tfoot>
		<tr>
			<th>Rendering engine</th>
			<th>Browser</th>
			<th>Platform(s)</th>
			<th>Engine version</th>
			<th>CSS grade</th>
		</tr>
	</tfoot>
</table>*/
}

?>